<%@page contentType="text/html;charset=UTF-8"%>
<%@ page import="whf.framework.web.Constants"%>
<%@ page import="whf.framework.meta.service.*"%>
<%@ page import="java.util.*"%>
<%@ page import="whf.framework.util.*"%>

<%@taglib uri="/WEB-INF/tlds/struts-bean.tld" prefix="bean"%>
<%@taglib uri="/WEB-INF/tlds/struts-html.tld" prefix="html"%>
<%@taglib uri="/WEB-INF/tlds/framework.tld" prefix="framework"%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"    "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title><bean:write name="STRUTS-META" property="name" /></title>
<jsp:include page="/common/inc/select.jsp" />
</head>
<script language="javascript">
function objectChanged(){
	currentForm().webMethod.value="list";
	currentForm().submit();
}
</script>
<%
java.util.List dataSource = new ArrayList();
long objectId = ParamUtils.getLongParameter(request, "object", 0);
if(objectId == 0){
	Long lv = (Long)session.getAttribute("lastestSelectObjectId");
	if(lv != null){
		objectId = lv.longValue();
	}
} else {
	session.setAttribute("lastestSelectObjectId", new Long(objectId));
}
if(objectId != 0){
	ObjectService service = ObjectServiceImp.getObjectService();
	dataSource = ((whf.framework.meta.entity.Object)service.findByPrimaryKeyWithoutLazy(new Long(objectId))).getSortedProperties();
}
%>
<body>
<html:form action='<%=  (String)request.getAttribute(Constants.STRUTS_PATH) %>' method="post">
<table width="100%">
	<tr>
		<td align='right'>
		Objects:<framework:select name="object" boClassName="whf.framework.meta.entity.Object" onchange="objectChanged()" selectedProperty="id" selectedValues="<%= new Long(objectId) %>" />
		</td>
	</tr>
</table>
<html:hidden property="webMethod" value="list" />
<framework:table pkStyle="checkbox_counter" border="1" cellspacing="0" cellpadding="0" navPosition="both" dataSource="<%= dataSource %>" pageSize="50">
<framework:caption><span class="whf_object_title"><bean:write name="STRUTS-META" property="name" /></span></framework:caption>
</framework:table>
<input type='button' onclick='submitForm("prepareCreate")' value='<bean:message key="form.create" />' />
<input type='button' onclick='submitForm("prepareUpdate")' value='<bean:message key="form.update" />' />
<input type='button' onclick='submitForm("delete")' value='<bean:message key="form.delete" />' />
<html:submit><bean:message key="form.submit" /></html:submit>
<html:reset><bean:message key="form.reset" /></html:reset>
</html:form>

</body>
</html> 